import java.util.ArrayList;
import java.util.Scanner;
import java.util.TreeSet;

/**
 * 9. 考勤刷卡
 * https://www.lanqiao.cn/problems/2380/learning/?page=1&first_category_id=1&second_category_id=3&tag_relation=intersection&tags=%E7%9C%81%E8%B5%9B,2022&sort=pass_rate&asc=0
 */
public class Main8 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        ArrayList<String> time = new ArrayList<>();
        TreeSet<Integer> id = new TreeSet<>(); // 去重并且排序
        int n = scan.nextInt();
        for(int i = 0;i < n;i++) {
            time.add(scan.next());
            id.add(scan.nextInt());
        }
        // 直接输出id里的值即可
        for(Integer x : id) {
            System.out.println(x);
        }
        scan.close();
    }
}
